package com.after.saas.common.model.vo;

import com.after.saas.common.constants.SortEnum;
import com.after.saas.common.constants.StatusEnum;
import com.after.saas.common.validate.EnumValue;
import com.after.saas.common.validate.Group;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;

/**
 * @Description
 * @Classname ValidBean
 * @Author hjchen
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2022/11/4 16:27
 */

@Data
public class ValidBeanVO {

    private String operaType;

    @NotBlank(message = "sort不能为空")
    @EnumValue(value = SortEnum.class, method = "getSort")
    private String sort;
    @NotBlank(message = "desc不能为空",groups = Group.AddGroup.class)
    private String desc;

    @NotEmpty(message = "name不能为空")
    @Pattern(regexp = "^[0-9A-Za-z]{10}|NO$",message = "请输入10位海关编码或者NO")
    private String name;

    @NotEmpty(message = "code不能为空")
    @Pattern(regexp = "^[0-9A-Za-z]{18}|NO$",message = "请输入18位信用代码或者NO")
    private String code;

    @NotNull(message = "status不能为空")
    @EnumValue(value = StatusEnum.class)
    private Integer status;

    @NotEmpty(message = "登录名不能为空")
    @Pattern(regexp = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$",message = "请输入正确的手机号！")
    private String mobile;

    @Valid
    @NotNull(message = "validDemo不能为空")
    private ValidDemo validDemo;

    @Valid
    @NotNull(message = "validBeans不能为空")
    private List<ValidDemo> validBeans;
}
